import request from '@/utils/request.js'

// 获取文章分类列表
export const getArtListAPI = () => {
  return request({
    url: '/my/cate/list'
  })
}

// 新增文章分类
export const addArtCateAPI = (data) => {
  return request({
    method: 'post',
    url: '/my/cate/add',
    data
  })
}

// 根据 Id 删除文章分类
export const delArtCateAPI = (id) => {
  return request({
    method: 'delete',
    url: '/my/cate/del',
    params: {
      id
    }
  })
}
// 根据 Id 获取文章分类数据
export const getArtCateAPI = (id) => {
  return request({
    url: '/my/cate/info',
    params: {
      id
    }
  })
}

// 根据 Id 更新文章分类数据
export const updateArtCateAPI = (data) => {
  return request({
    url: '/my/cate/info',
    method: 'put',
    data
  })
}

// 获取文章的列表数据
export const getArtInfoAPI = (data) => {
  return request({
    url: '/my/article/list',
    params: {
      ...data
    }
  })
}

// 根据 Id 删除文章数据
export const delArtInfoAPI = (id) => {
  return request({
    url: '/my/article/info',
    method: 'delete',
    params: {
      id
    }
  })
}

// 根据 Id 获取文章详情
export const getArtCateInfoAPI = (id) => {
  return request({
    url: '/my/article/info',
    params: {
      id
    }
  })
}

// 发布新文章
export const addArtAPI = (data) => {
  return request({
    method: 'post',
    url: '/my/article/add',
    data
  })
}
